#include <zmq.hpp>
#include <stdio.h>
#include "util.h"

int main(int argc, const char *argv[])
{
    zmq::context_t context(1);
    zmq::socket_t socket_get(context,ZMQ_SUB);
    socket_get.setsockopt(ZMQ_SUBSCRIBE,"",0);
    socket_get.connect("tcp://127.0.0.1:20001");

    while(true){
        zmq::message_t msg;
        socket_get.recv(&msg);
        if(msg.size()==0)
            break;
	u64 data[2];
	memcpy(data, msg.data(), sizeof(data));
	u64 t = ms();
        printf("%s: %ld %ld %ld %ld\n", argv[0], data[0], data[1], t, t - data[1]);
    }
    return 0;
}
